package Interface;

import java.awt.BorderLayout;
import java.awt.ComponentOrientation;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;

import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTable;
import javax.swing.border.EmptyBorder;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.Box;
import javax.swing.JScrollPane;
import javax.swing.JEditorPane;
import javax.swing.border.TitledBorder;
import javax.swing.border.EtchedBorder;
import javax.swing.border.SoftBevelBorder;
import javax.swing.border.BevelBorder;
import javax.swing.UIManager;
import javax.swing.border.LineBorder;
import javax.swing.table.DefaultTableModel;

import java.awt.Color;
import javax.swing.JTextField;

public class BusquedaDeTitularDialogo extends iDialogGeneral {

	private static final long serialVersionUID = 1L;
	private final JPanel contentPanel = new JPanel();
	private String reglamento;
	private JEditorPane editorPane;
	private JTextField textField;
	private JTextField textField_1;
	private JTextField textField_2;
	private JTextField textField_3;
	private JTable table;

	public BusquedaDeTitularDialogo(PantallaPrincipal perteneciente, boolean modal) {
		
		super(perteneciente,modal);
		setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
		Dimension tam= new Dimension(400, 280);
		setTamanio(new Dimension(700, 600));
		
		getContentPane().setLayout(new BorderLayout());
		{
			JPanel panelTitulo = new JPanel();
			getContentPane().add(panelTitulo, BorderLayout.NORTH);
			{
				JLabel lblTitulo = new JLabel("Cuadro de dialogo\t");
				lblTitulo.setFont(new Font("Vani", Font.PLAIN, 20));
				panelTitulo.add(lblTitulo);
			}
		}
		contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
		getContentPane().add(contentPanel, BorderLayout.CENTER);
		contentPanel.setLayout(new BorderLayout(0, 0));
		{
			
			
			DefaultTableModel modelo1 = new DefaultTableModel(){
				/**
				 * 
				 */
				private static final long serialVersionUID = 1L;
				@SuppressWarnings("rawtypes")
				Class[] columnTypes = new Class[] {
						Boolean.class, Object.class, Object.class,Object.class, Object.class
					};
					@SuppressWarnings({ "unchecked", "rawtypes" })
					public Class getColumnClass(int columnIndex) {
						return columnTypes[columnIndex];
					}
				};
			String[] nombresColumna = {"","Nombre", "Apellido","Tipo de documento","Nro Documento"};
			modelo1.setColumnIdentifiers(nombresColumna);	
			modelo1.setRowCount(5);//EL NUMERO DE FILAS DEPENDE DE LA CANTIDAD DE CANDIDATOS ENCONTRADOS
			//	modelo.setColumnCount(2);
			
			table = new JTable();
			table.setModel(modelo1);
			modelo1.setRowCount(10);
			
			
			table.getColumnModel().getColumn(0).setPreferredWidth(15);
			table.getColumnModel().getColumn(1).setPreferredWidth(100);
			table.getColumnModel().getColumn(1).setMinWidth(100);
			table.getColumnModel().getColumn(2).setPreferredWidth(100);
			table.getColumnModel().getColumn(2).setMinWidth(100);
			table.getColumnModel().getColumn(3).setPreferredWidth(80);
			table.getColumnModel().getColumn(3).setMinWidth(80);
			table.getColumnModel().getColumn(4).setPreferredWidth(120);
			table.getColumnModel().getColumn(4).setMinWidth(120);
			
			
			JScrollPane scrollPane = new JScrollPane(table);
			scrollPane.setPreferredSize(new Dimension(378, 300));
			contentPanel.add(scrollPane);
			
		
			
		}
		{
			JPanel panel = new JPanel();
			panel.setPreferredSize(new Dimension(10, 130));
			contentPanel.add(panel, BorderLayout.NORTH);
			panel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
			{
				JPanel panel_1 = new JPanel();
				panel_1.setPreferredSize(new Dimension(320, 75));
				panel.add(panel_1);
				{
					JPanel panel_3 = new JPanel();
					panel_3.setMaximumSize(new Dimension(32767, 100));
					panel_3.setPreferredSize(new Dimension(100, 65));
					panel_1.add(panel_3);
					panel_3.setLayout(new BoxLayout(panel_3, BoxLayout.Y_AXIS));
					{
						Component horizontalStrut = Box.createHorizontalStrut(20);
						horizontalStrut.setMaximumSize(new Dimension(200, 5));
						panel_3.add(horizontalStrut);
					}
					{
						JLabel lblNewLabel = new JLabel("Nombre");
						lblNewLabel.setFont(new Font("SansSerif", Font.BOLD, 12));
						panel_3.add(lblNewLabel);
					}
					{
						Component horizontalStrut = Box.createHorizontalStrut(20);
						horizontalStrut.setMinimumSize(new Dimension(20, 5));
						horizontalStrut.setPreferredSize(new Dimension(20, 5));
						horizontalStrut.setMaximumSize(new Dimension(200, 15));
						panel_3.add(horizontalStrut);
					}
					{
						JLabel lblApellido = new JLabel("Apellido");
						lblApellido.setFont(new Font("SansSerif", Font.BOLD, 12));
						panel_3.add(lblApellido);
					}
				}
				{
					JPanel panel_2 = new JPanel();
					panel_2.setMaximumSize(new Dimension(32767, 100));
					panel_2.setPreferredSize(new Dimension(180, 65));
					panel_1.add(panel_2);
					panel_2.setLayout(new BoxLayout(panel_2, BoxLayout.Y_AXIS));
					{
						textField = new JTextField();
						textField.setMaximumSize(new Dimension(2147483647, 28));
						panel_2.add(textField);
						textField.setColumns(10);
					}
					{
						Component horizontalStrut = Box.createHorizontalStrut(20);
						horizontalStrut.setMaximumSize(new Dimension(200, 5));
						panel_2.add(horizontalStrut);
					}
					{
						textField_1 = new JTextField();
						textField_1.setMaximumSize(new Dimension(2147483647, 28));
						textField_1.setColumns(10);
						panel_2.add(textField_1);
					}
				}
			}
			{
				JPanel panel_1 = new JPanel();
				panel_1.setPreferredSize(new Dimension(330, 75));
				panel.add(panel_1);
				{
					JPanel panel_2 = new JPanel();
					panel_2.setPreferredSize(new Dimension(140, 65));
					panel_1.add(panel_2);
					panel_2.setLayout(new BoxLayout(panel_2, BoxLayout.Y_AXIS));
					{
						Component horizontalStrut = Box.createHorizontalStrut(20);
						horizontalStrut.setMaximumSize(new Dimension(200, 5));
						panel_2.add(horizontalStrut);
					}
					{
						JLabel lblDni = new JLabel("Tipo de documento");
						lblDni.setFont(new Font("SansSerif", Font.BOLD, 12));
						panel_2.add(lblDni);
					}
					{
						Component horizontalStrut = Box.createHorizontalStrut(20);
						horizontalStrut.setPreferredSize(new Dimension(20, 5));
						horizontalStrut.setMinimumSize(new Dimension(20, 5));
						horizontalStrut.setMaximumSize(new Dimension(200, 15));
						panel_2.add(horizontalStrut);
					}
					{
						JLabel lblNmeroDeDocumento = new JLabel("N\u00FAmero de Documento");
						lblNmeroDeDocumento.setFont(new Font("SansSerif", Font.BOLD, 12));
						panel_2.add(lblNmeroDeDocumento);
					}
				}
				{
					JPanel panel_2 = new JPanel();
					panel_2.setPreferredSize(new Dimension(170, 65));
					panel_1.add(panel_2);
					panel_2.setLayout(new BoxLayout(panel_2, BoxLayout.Y_AXIS));
					{
						textField_2 = new JTextField();
						textField_2.setMaximumSize(new Dimension(2147483647, 28));
						textField_2.setColumns(10);
						panel_2.add(textField_2);
					}
					{
						Component horizontalStrut = Box.createHorizontalStrut(20);
						horizontalStrut.setMaximumSize(new Dimension(200, 5));
						panel_2.add(horizontalStrut);
					}
					{
						textField_3 = new JTextField();
						textField_3.setMaximumSize(new Dimension(2147483647, 28));
						textField_3.setColumns(10);
						panel_2.add(textField_3);
					}
				}
			}
			{
				JPanel panel_1 = new JPanel();
				panel.add(panel_1);
				{
					JButton btnBuscar = new JButton("Buscar");
					panel_1.add(btnBuscar);
				}
			}
		}
		{
			{
				{
					if(reglamento!=null){ editorPane.setText("Texto");}
				}
			}
		}

		{
			JPanel buttonPane = new JPanel();
			buttonPane.setMaximumSize(panel);
			buttonPane.setLayout(new FlowLayout(FlowLayout.CENTER));
			getContentPane().add(buttonPane, BorderLayout.SOUTH);
			{
				JButton okButton = new JButton("Aceptar");
				okButton.setActionCommand("OK");
				buttonPane.add(okButton);
				okButton.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) { 
					getParent().setFocusable(true);
					dispose();
					}
				});			
			}
			{
				Component horizontalStrut = Box.createHorizontalStrut(20);
				buttonPane.add(horizontalStrut);
			}
			{
				JButton cancelButton = new JButton("Cancelar");
				cancelButton.setActionCommand("Cancel");
				buttonPane.add(cancelButton);
				cancelButton.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) { 
					getParent().setFocusable(true);
					dispose();
					}
				});
						
			}
		}
	}
	
	public String getReglamento() {
		String ret= editorPane.getText();
		return ret;
	}

	public void setReglamento(String reglamento) {
		this.reglamento = reglamento;
	}

}
